package com.example.myapplication.HomeRecyclerViewFragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.myapplication.HomeRecyclerViewAdapter.XianShiZheKouAdapter;
import com.example.myapplication.HomeRecyclerViewFragment.HomeRecyclerViewBean.XianShiZheKuoBean;
import com.example.myapplication.R;

import java.util.ArrayList;
import java.util.List;

public class XianShiZheKou extends Fragment {
    RecyclerView XianShiZheKou_RL;
    List<XianShiZheKuoBean> list=new ArrayList<>();
    XianShiZheKouAdapter xianShiZheKouAdapter;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.fragment_xianshizhekou,container,false);
        initView(view);

        return view;
    }

    private void initView(View view) {
        XianShiZheKou_RL=view.findViewById(R.id.XianShiZheKuo_RL);
        list.add(new XianShiZheKuoBean(R.mipmap.homefeijif22,"F-22"));
        list.add(new XianShiZheKuoBean(R.mipmap.homefeijif35,"F-35"));
        list.add(new XianShiZheKuoBean(R.mipmap.homefeijij10c,"J-10C"));
        list.add(new XianShiZheKuoBean(R.mipmap.homefeijij16,"J-16"));
        list.add(new XianShiZheKuoBean(R.mipmap.homefeijisu35,"SU-35"));
        LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this.getActivity());
        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
        XianShiZheKou_RL.setLayoutManager(linearLayoutManager);
        xianShiZheKouAdapter=new XianShiZheKouAdapter(list);
        XianShiZheKou_RL.setAdapter(xianShiZheKouAdapter);

    }
}
